using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VICC_VKPRICE
    {
        VICC_VKPWARP WARP = new VICC_VKPWARP();
        VICC_VKPWEFT WEFT = new VICC_VKPWEFT();

    }
    public partial class VICC_VKPRICE
    {
        public void MapICC_VKPRICE(ref DataRow dwLocal, DataRow dwData)
        {
            BlindMap(ref dwLocal, dwData);
        }
        public void SaveICC_VKPRICE(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            DataSet Result = new DataSet();
            DataTable tbLocal = null;
            DataRow dwLocal = null;
            bool flgExist = false;
            Result = QueryICC_VKPRICE(dwData);
            if (Result.Tables.Count > 0)
            {
                tbLocal = Result.Tables[0];
                if (tbLocal.Rows.Count > 0)
                {
                    flgExist = true;
                    dwLocal = tbLocal.Rows[0];
                }
                else
                {
                    dwLocal = tbLocal.NewRow();
                }
            }

            MapICC_VKPRICE(ref dwLocal, dwData);

            if (!flgExist)
            {
                InsertICC_VKPRICE(dwData, 1);
            }
            UpdateICC_VKPRICE(dwLocal);
        }
        public void InsertICC_VKPRICE(DataRow dwData, int option = 1)
        {
            OracleCommand or1;
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    break;
                case 2:
                    or1.CommandText = "INSERT INTO ICC_VKPRICE (CONTROL,ROWNID,MANDANT,MKUNDER,KDKUNDNA,VKPAUFKRS,VKPAUFLFD,VKPAUFPOS, VKPKOLL,VKPART,"
                        + "VAABEZ,VKPQTY,VKPUNIT,USD2RMB,CURRENCY,MCPRICE,PREH,NEWUSER)  SELECT 'NO' AS CONTROL,SEQ_ICC_ITX.NEXTVAL AS ROWNID,X.* FROM"
                        + " (SELECT VKKMANDANT AS MANDANT,MAX(VKKKUNDNR) AS MKUNDER, MAX(KDKUNDNA) AS KDKUNDNA,"
                        + " VKKAUFKRS AS VKPAUFKRS,VKKAUFLFD AS VKPAUFLFD,COUNT(*) AS VKPAUFPOS,MAX(VKPKOLL) AS VKPKOLL,"
                        + "  MAX(VKPART) AS VKPART,MAX(SUBSTR(SDDATEN,2,22)) AS VAABEZ, SUM(VKPMENGE1*0.01) AS VKPQTY,MAX(VKPMEEH) AS VKPUNIT,"
                        + "  MAX(TO_NUMBER(VKKKURS))*0.0001 AS USD2RMB, MAX(VKKWAEHRSL) AS CURRENCY,MAX(VKPPREIS*0.001) AS MCPRICE,MAX(VKPPREH) AS PREH,MAX(VKKNEUBEN) AS NEWUSER "
                        + "  FROM VKKOPF K  JOIN KDSTAMM ON VKKKUNDNR=KDKUNDNR  JOIN VKPOS ON VKPSA='  ' AND VKKSA='  ' AND VKPMANDANT=VKKMANDANT"
                        + " AND VKKAUFKRS=VKPAUFKRS AND VKKAUFLFD= VKPAUFLFD JOIN VAART ON VKPKOLL=VAAKOLL AND VKPART=VAAART LEFT JOIN SDDAT ON SDSA='0178' AND SDKEY = '00'||VAAARTGRP||'                  V'"
                        + " GROUP BY VKKMANDANT,VKKAUFKRS,VKKAUFLFD) X "
                        + " WHERE  NOT EXISTS (SELECT 1 FROM ICC_VKPRICE P WHERE P.VKPAUFKRS=X.VKPAUFKRS AND P.VKPAUFLFD=X.VKPAUFLFD)";
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
        public DataSet QueryICC_VKPRICE(DataRow dwData, int option = 1)
        {
            DataSet Return;
            DataSet Result = new DataSet();
            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = " SELECT I.*,VKKLIEFBED FROM ICC_VKPRICE I LEFT JOIN VKKOPF ON VKKSA='  ' AND VKKAUFKRS=:VKPAUFKRS: AND VKKAUFLFD=:VKPAUFLFD: WHERE  ROWNID=:ROWNID:"; ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 2:
                    or1.CommandText = " SELECT * FROM ICC_VKPRICE WHERE MANDANT=:MANDANT: AND CONTROL=:CONTROL:"; ;
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 3:
                    or1.CommandText = "SELECT * FROM ICC_VKPRICE P WHERE MANDANT=:MANDANT: AND VKPART LIKE '" + dwData["VKPART"].ToString().Trim() + "%' "//AND NEWTIME LIKE '%" + dwData["NEWTIME"].ToString().Trim() + "%'"
                         + " ORDER BY NEWTIME";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 4:
                    or1.CommandText = " SELECT * FROM ICC_VKPRICE WHERE MANDANT=:MANDANT: AND VKPAUFKRS=:VKPAUFKRS: AND VKPAUFLFD=:VKPAUFLFD:"
                         + " ORDER BY VKPAUFKRS,VKPAUFLFD,MTYE,MPOS";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 5:
                    or1.CommandText = " SELECT P.* from ICC_VKPRICE P WHERE   not  EXISTS (SELECT 1 FROM vkpos x WHERE X.VKPSA='  ' AND P.VKPAUFKRS=X.VKPAUFKRS AND P.VKPAUFLFD=X.VKPAUFLFD and p.vkpart=x.vkpart)";
                    break;
                case 6:
                    or1.CommandText = "SELECT distinct a.rownid,A.MANDANT,A.VKPAUFKRS,A.VKPAUFLFD,A.VKPKOLL,a.vkpart,trim(a.vaabez) as vaabez, "
                        + " trim(a.construction) as construction, e.waffddik*0.01 as warpden,a.mvkweftden as weftden,A.CURRENCY,A.PREH,A.VKPQTY, "
                        + " STRAGG(DISTINCT TRIM( B.VKPFARBE))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD, "
                        + " (case when b.vkpmenge1>300000 then 1 when b.vkpmenge1>200000 and b.vkpmenge1<=300000 then 2 "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000 then 3 when b.vkpmenge1>50000 and b.vkpmenge1<=100000 then 4 else 5 end )) AS COLOR, "
                        + " STRAGG(DISTINCT TRIM(C.MYARN)||'*'||TRIM(D.MYARN))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD) AS YARN, "
                        + " A.MKUNDER,f.kdkname,(case when b.vkpmenge1>300000 then '>3000' when b.vkpmenge1>200000 and b.vkpmenge1<=300000 then '2000-3000' "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000 then '1000-2000'  "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000 then '500-1000' else '<500' end ) type, "
                        + " 0 as mdelqty,0 as ydelqty,0 as wefttot,(SELECT nvl(SUM(X.musage * 0.01),0) FROM ICC_VKPWARP X WHERE X.MANDANT = A.MANDANT "
                        + " and a.vkpaufkrs = x.vkpaufkrs and a.vkpauflfd =x.vkpauflfd ) as warpusage, "
                        + " MAX(NVL(TRIM(c.mpricem),0))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD) as warpprice, "
                        + " (SELECT nvl(SUM(X.musage * 0.01),0) FROM ICC_VKPWEFT X WHERE X.MANDANT = A.MANDANT "
                        + " and a.vkpaufkrs = x.vkpaufkrs and a.vkpauflfd =x.vkpauflfd ) as weftusage,MAX(NVL(TRIM(d.mpricem),0))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD) as weftprice, "
                        + " round((case when b.vkpmenge1>300000 then a.mcostmy when b.vkpmenge1>200000 and b.vkpmenge1<=300000 then a.mcostmy*1.1 "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000 then a.mcostmy*1.2 "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000 then a.mcostmy*1.5 else a.mcostmy*2 end ),2) as yarnvalue, "
                        + " MAX(NVL(TRIM(c.mpriced),0))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD) as warped,MAX(NVL(TRIM(d.mpriced),0))OVER(PARTITION BY A.VKPAUFKRS,A.VKPAUFLFD) as wefted, "
                        + " round((case when b.vkpmenge1>300000 then a.mcostdy when b.vkpmenge1>200000 and b.vkpmenge1<=300000 then a.mcostdy*1.1 "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000 then a.mcostdy*1.2 "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000 then a.mcostdy*1.5 else a.mcostdy*2 end ),2) as dyevalue,a.mcostfin, "
                        + " a.mcostpak+a.mcostfvv as mcostpakvv,a.mcostfadd,a.mpriceagent,a.mpriceship,a.mpriceflight,A.MCOSTAGENT,A.MCOSTSHIP,A.MCOSTFLIGHT,a.mcostadd, "
                        + " round((case when b.vkpmenge1>300000 then a.mvkcost  "
                        + " when b.vkpmenge1>200000 and b.vkpmenge1<=300000 then (a.mcostmy+a.mcostdy)*1.1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000 then (a.mcostmy+a.mcostdy)*1.2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000 then (a.mcostmy+a.mcostdy)*1.5+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd  "
                        + " else (a.mcostmy+a.mcostdy)*2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd end ),2) as mvkcost, "
                        + " (case when b.vkpmenge1>300000  "
                        + " then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2)  "
                        + " when b.vkpmenge1>200000 and b.vkpmenge1<=300000  "
                        + " then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.5+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " else ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) end ) as mcostgross, "
                        + " round((case when b.vkpmenge1>300000  "
                        + " then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>200000 and b.vkpmenge1<=300000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.5+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " else ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) end )/1.17,2) as mcostnet, "
                        + " round((case when b.vkpmenge1>300000  "
                        + " then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "      DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2)  "
                        + " when b.vkpmenge1>200000 and b.vkpmenge1<=300000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.1+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>100000 and b.vkpmenge1<=200000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " when b.vkpmenge1>50000 and b.vkpmenge1<=100000  "
                        + "  then ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "       DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*1.5+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) "
                        + " else ROUND(DECODE(CURRENCY,'RMB',DECODE(TRIM(PREH),'M',MCPRICE,'YRD',MCPRICE/0.9144), "
                        + "      DECODE(TRIM(PREH),'M',MCPRICE*USD2RMB*0.99*1.17,'YRD',MCPRICE*USD2RMB*0.99*1.17/0.9144)),2) "
                        + "       -round((a.mcostmy+a.mcostdy)*2+a.mcostfin+a.mcostpak+a.mcostfvv+a.mcostfadd+a.mcostagent+a.mcostship+a.mcostflight+a.mcostadd,2) end ) "
                        + "       /1.17/(e.waffddis*0.01)*10000) as mcostnetw,TRIM(h.hrnname) AS HRNNAME "
                        + " from icc_vkprice a,vkpos b,icc_vkpwarp c,icc_vkpweft d,wastamm e,kdstamm f,vkkopf g,hrstamm h "
                        + " where a.mandant = b.vkpmandant and a.vkpaufkrs = b.vkpaufkrs  "
                        + " and a.vkpauflfd = b.vkpauflfd  and a.mandant = g.vkkmandant "
                        + " and a.vkpaufkrs = g.vkkaufkrs and a.vkpauflfd = g.vkkauflfd  "
                        + " and b.vkpsa = g.vkksa and a.mandant = c.mandant(+) "
                        + " and a.vkpaufkrs = c.vkpaufkrs(+) and a.vkpauflfd = c.vkpauflfd(+) "
                        + " and a.mandant = d.mandant(+) and a.vkpaufkrs = d.vkpaufkrs(+) "
                        + " and a.vkpauflfd = d.vkpauflfd(+) and a.mandant = e.wamandant(+) "
                        + " and substr(a.vkpart,1,20) = e.waart(+) and a.mandant = f.kdmandant(+) "
                        + " and a.mkunder = f.kdkundnr(+) "
                        + " and g.vkkmandant = h.hrmandant and g.vkksachbe = h.hrbenid "
                        + " and a.vkpart = :VKPART: "
                        + " and b.vkpsa <>'AJ' ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                default:
                    break;
            }           
            Result = Connect2Proxy(or1);
            if (Result.Tables.Count > 0)
                Result.Tables[0].TableName = "ICC_VKPRICE";
            Return = Result;
            return Return;
        }
        public void DeleteICC_VKPRICE(DataRow dwData, int option = 1)
        {
            OracleCommand or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 1:
                    or1.CommandText = " DELETE FROM ICC_VKPRICE WHERE  ROWNID=:ROWNID"; ;
                    or1.Parameters.Add("ROWNID", OracleType.NVarChar).Value = dwData["ROWNID"].ToString();
                    WARP.DeleteICC_VKPWARP(dwData, 2);
                    WEFT.DeleteICC_VKPWEFT(dwData, 2);
                    break;
            }
            Connect2Proxy(or1);
        }
        public void UpdateICC_VKPRICE(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            OracleCommand or1;
            DataSet Result = new DataSet();
            or1 = OracleDB.CreateCommand();
            #region====Command====
            or1.CommandText = " UPDATE ICC_VKPRICE SET "
            + "CONTROL=:CONTROL:,"
            + "MANDANT=:MANDANT:,"
            + "ROWNID=:ROWNID:,"
            + "MKUNDER=:MKUNDER:,"
            + "KDKUNDNA=:KDKUNDNA:,"
            + "VKPAUFKRS=:VKPAUFKRS:,"
            + "VKPAUFLFD=:VKPAUFLFD:,"
            + "VKPAUFPOS=:VKPAUFPOS:,"
            + "VKPKOLL=:VKPKOLL:,"
            + "VKPART=:VKPART:,"
            + "VAABEZ=:VAABEZ:,"
            + "CONSTRUCTION=:CONSTRUCTION:,"
            + "VKPQTY=:VKPQTY:,"
            + "VKPUNIT=:VKPUNIT:,"
            + "MVKWEFTDEN=:MVKWEFTDEN:,"
            + "USD2RMB=:USD2RMB:,"
            + "CURRENCY=:CURRENCY:,"
            + "MCPRICE=:MCPRICE:,"
            + "PREH=:PREH:,"
            + "MVKCOST=:MVKCOST:,"
            + "MCOSTMW=:MCOSTMW:,"
            + "MCOSTMF=:MCOSTMF:,"
            + "MCOSTMY=:MCOSTMY:,"
            + "MCOSTDW=:MCOSTDW:,"
            + "MCOSTDF=:MCOSTDF:,"
            + "MCOSTDY=:MCOSTDY:,"
            + "MCOSTFIN=:MCOSTFIN:,"
            + "MCOSTPAK=:MCOSTPAK:,"
            + "MCOSTFVV=:MCOSTFVV:,"
            + "MCOSTFADD=:MCOSTFADD:,"
            + "MCOSTPROD=:MCOSTPROD:,"
            + "MCOSTU=:MCOSTU:,"
            + "MPRICEAGENT=:MPRICEAGENT:,"
            + "MCOSTAGENT=:MCOSTAGENT:,"
            + "MUNITAGENT=:MUNITAGENT:,"
            + "MPRICESHIP=:MPRICESHIP:,"
            + "MCOSTSHIP=:MCOSTSHIP:,"
            + "MUNITSHIP=:MUNITSHIP:,"
            + "MPRICEFLIGHT=:MPRICEFLIGHT:,"
            + "MCOSTFLIGHT=:MCOSTFLIGHT:,"
            + "MUNITFLIGHT=:MUNITFLIGHT:,"
            + "MCOSTADD=:MCOSTADD:,"
            + "MUNITADD=:MUNITADD:,"
            + "MCOSTGROSS=:MCOSTGROSS:,"
            + "MCOSTNET=:MCOSTNET:,"
            + "MCOSTNETW=:MCOSTNETW:,"
            + "MCOSTF=:MCOSTF:,"
            + "REMARK=:REMARK:," 
            + "CHGUSER=:CHGUSER:,"
            + "CHGTIME=:CHGTIME: "
                + " WHERE ROWNID=:ROWNID:";
            #endregion
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            Connect2Proxy(or1);
        }
    }
}
